package com.coda.service.impl;

import com.coda.context.BaseContext;
import com.coda.mapper.UserWordMapper;
import com.coda.pojo.vo.UserWordVo;
import com.coda.service.UserWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserWordServiceImpl implements UserWordService {

    @Autowired
    private UserWordMapper userWordMapper;
    /**
     * 删除当前用户默写的单词
     */
    @Override
    public int delete(Integer id) {
        return userWordMapper.deleteById(id, BaseContext.getCurrentId());
    }

    /**
     * 用户收藏
     * @param userWordVo
     * @return
     */
    @Override
    public int collect(UserWordVo userWordVo) {
        return userWordMapper.insertCollect(userWordVo);
    }

    /**
     * 取消收藏
     */
    @Override
    public int deleteCollect(Integer id) {
        return userWordMapper.deleteCollect(id);
    }
}
